<?php
namespace app\common\enum;

/**
 * 订单相关 枚举类型
 * Class OrderEnum
 * @Author FZR
 * @package app\common\enum
 */
class OrderEnum
{

    //订单状态order_status
    const ORDER_STATUS_CANCLE = 0;//已取消
    const ORDER_STATUS_NO_PAID = 1;//待支付
    const ORDER_STATUS_DELIVERY = 4;//待发货
    const ORDER_STATUS_GOODS = 5;//待收货
    const ORDER_STATUS_COMPLETE = 6;//已完成
    const ORDER_STATUS_DOWN = 7;//已退货



    /**
     * @Notes: 订单状态
     * @Author: Toren
     * @param bool $type
     * @return array|mixed|string
     */
    public static function getOrderStatus($type=true)
    {
        $desc = [
            self::ORDER_STATUS_CANCLE  => '已取消',
            self::ORDER_STATUS_NO_PAID  => '待支付',
            self::ORDER_STATUS_DELIVERY => '待发货',
            self::ORDER_STATUS_GOODS    => '待收货',
            self::ORDER_STATUS_COMPLETE => '已完成',
            self::ORDER_STATUS_DOWN     => '已关闭'
        ];

        if ($type === true) {
            return $desc;
        }
        return $desc[$type] ?? '未知来源';
    }

}
